#!/bin/sh

NEWS_DIR="data"
NEWS_FILE="${NEWS_DIR}/newsItem"

if [[ ! -x $NEWS_DIR ]]; then
    echo "Creating news dir ..."
    mkdir $NEWS_DIR
fi
if [[ ! -s $NEWS_FILE ]]; then
    echo "Either the file doesn't exist, or it has zero length."
    echo "Aborting ..."
    exit
fi
echo
echo "Performing dry-run first ..."
echo
./admin/publishNews.py --dry-run -f $NEWS_FILE
echo
echo "To publich news to SF.net and LaunchPad, hit ENTER."
echo "To abort and edit, hit ^C (Control-C) ..."
echo
read
echo "Publishing to SF.net News and LaunchPad Announcements ..."
./admin/publishNews.py -f $NEWS_FILE
